]> permondes.de Git - Analog_Engine.git/blobdiff - scripts/EP1 10.03 Coupled Pendulums.LACE
Further examples of harmonic oscillation
[Analog_Engine.git] / scripts / EP1 10.03 Coupled Pendulums.LACE
diff --git a/scripts/EP1 10.03 Coupled Pendulums.LACE b/scripts/EP1 10.03 Coupled Pendulums.LACE
new file mode 100644 (file)
index 0000000..5ef0517
--- /dev/null
@@ -0,0 +1,34 @@
+# 2 coupled pendulums
+# x1'' = -k1*x1 + k*(x2-x1)
+# x2'' = -k2*x2 - k*(x2-x1)
+# xi are the displacement of the pendulum to its resting position
+
+coefficient.1 -> k1
+coefficient.2 -> k2
+coefficient.3 -> k
+coefficient.5(-1) -> -x10 # initial displacement x1
+coefficient.6(-1) -> -x20 # initial displacement x2
+
+iintegrate x1'' -> -x1'
+iintegrate -x1' -> x1
+  IC: -x10
+
+iintegrate x2'' -> -x2'
+iintegrate -x2' -> x2
+  IC: -x20
+
+cmultiply x1, k1 -> k1*x1
+cmultiply x2, k2 -> k2*x2
+
+invert x1 -> -x1
+isum x2, -x1 -> -(x2-x1)
+cmultiply -(x2-x1), k -> -k*(x2-x1)
+
+isum k1*x1, -k*(x2-x1) -> -k1*x1+k*(x2-x1)
+assign -k1*x1+k*(x2-x1) -> x1''
+invert -k*(x2-x1) -> k*(x2-x1)
+isum k2*x2, k*(x2-x1) -> -k2*x2-k*(x2-x1)
+assign -k2*x2-k*(x2-x1) -> x2''
+
+output x1 -> out.x
+output x2 -> out.y